<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Sets the image opacity level</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="imagick.setimagemattecolor.html">Imagick::setImageMatteColor</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="imagick.setimageorientation.html">Imagick::setImageOrientation</a></div>
 <div class="up"><a href="class.imagick.html">Imagick</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="imagick.setimageopacity" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Imagick::setImageOpacity</h1>
  <p class="verinfo">(PECL imagick 2.0.0)</p><p class="refpurpose"><span class="refname">Imagick::setImageOpacity</span> &mdash; <span class="dc-title">Sets the image opacity level</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-imagick.setimageopacity-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>Imagick::setImageOpacity</strong></span>
    ( <span class="methodparam"><span class="type">float</span> <code class="parameter">$opacity</code></span>
   )</div>


  <p class="para rdfs-comment">
   Sets the image to the specified opacity level. 此方法在Imagick基于ImageMagick 6.3.1以上版本编译时可用。
   This method operates on all channels, which means that for example opacity value
   of 0.5 will set all transparent areas to partially opaque. To add transparency to
   areas that are not already transparent use <a href="imagick.evaluateimage.html" class="link">Imagick::evaluateImage()</a>
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-imagick.setimageopacity-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">opacity</code></em></dt>

     <dd>

      <p class="para">
       The level of transparency: 1.0 is fully opaque and 0.0 is fully
       transparent.
      </p>
     </dd>

    
   </dl>

  </p>

 </div>

 <div class="refsect1 returnvalues" id="refsect1-imagick.setimageopacity-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-imagick.setimageopacity-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-3248">
    <p><strong>Example #1 A <span class="function"><strong>Imagick::setImageOpacity()</strong></span> example</strong></p>
    <div class="example-contents"><p>
     An example of using Imagick::setImageOpacity()
    </p></div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/*&nbsp;Create&nbsp;the&nbsp;object&nbsp;*/<br /></span><span style="color: #0000BB">$image&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Imagick</span><span style="color: #007700">(</span><span style="color: #DD0000">'source.png'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;Set&nbsp;the&nbsp;opacity&nbsp;*/<br /></span><span style="color: #0000BB">$image</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setImageOpacity</span><span style="color: #007700">(</span><span style="color: #0000BB">0.7</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;output&nbsp;the&nbsp;image&nbsp;*/<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Content-type:&nbsp;image/png'</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #0000BB">$image</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="imagick.setimagemattecolor.html">Imagick::setImageMatteColor</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="imagick.setimageorientation.html">Imagick::setImageOrientation</a></div>
 <div class="up"><a href="class.imagick.html">Imagick</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
